<template>
	<div>
		<el-button :loading="loadingFlag" type="primary" @click="handle()">防止重复点击</el-button>
		<button ref="btn" @click="btn">普通按钮</button>
		<!-- <div ref="div" @click="div">快</div> -->
	</div>
</template>

<script>
	export default {
		data() {
			return {
				key: 'value v-preventReClick',
				loadingFlag: false
			}
		},
		methods: {
			handle() {
				this.loadingFlag = true
				setTimeout(() => {
					this.loadingFlag = false
				}, 2000)
				console.log(this.$refs.btn)
			},
			div() {
				this.$refs.div.style.color = '#ccc'
				console.log(this.$refs.div.style)
			},
			btn() {
				this.$refs.btn.disabled = true
				setTimeout(() => {
					this.$refs.btn.disabled = false
					console.log(this.$refs.btn)
				}, 2000)
				console.log(this.$refs.btn)
			}
		}
	}
</script>

<style lang="scss" scoped></style>
